<template>
	<div class="agenda-wrapper">
		<div class="agenda-content">
			<image class="home-title" id="agenda" src="https://static.inclusionconf.com/static/images/agenda-title-new2-2025.png?t=1" alt="" mode="heightFix">
				<div class="tabs">
					<div class="tab" :class="activeIndex === index ? 'active' : ''" v-for="(item, index) in agendas" :key="index" @click="activeFn(index, item)">{{ item['date' + En] }}</div>
				</div>
				<div class="agendas" v-if="agendas[activeIndex]">
					<div class="agenda" v-if="agendas[activeIndex].mainForum" @click="linkHostForum">
						<div class="agenda-top"><span>{{ $t('host') }}</span><small>{{ agendas[activeIndex].mainForum['name' + En].split('：')[1] }}</small></div>
						<div class="agenda-bottom">
							<span v-for="(ite, ind) in agendas[activeIndex].mainForum['content' + En]" :key="ind">· {{ ite }}</span>
						</div>
					</div>
					<block v-if="agendas[activeIndex].subForumList">
						<div class="agenda-item" v-for="(item, index) in agendas[activeIndex].subForumList" :key="index" @click="itemFn(item, index)">
							<div class="agenda-item-top"><span>{{ item.type == 'activity' ? $t('helpForumTop5') : $t('jianjieForum') }}</span><small>{{ item['name' + En] }}</small></div>
							<div class="agenda-item-bottom">
								{{ item['blurb' + En] }}
							</div>
							<div class="left">
								<i>{{ item['forumAddrValue' + En] }}</i>
								<span v-if="!En">馆</span>
							</div>
							<div class="huifang" v-if="item.liveSts == 1">{{ $t('liveStatus' + item.playSts) }}</div>
							<!-- <img class="img" src="https://static.inclusionconf.com/static/images/agenda-right.png" alt="" v-if="isPc"> -->
							<img class="img" src="https://static.inclusionconf.com/static/images/home-new-right.png" alt="">
						</div>
					</block>
				</div>
				<div class="btn" @click="linkForum">{{ $t('checkMore') }} <img class="img" src="https://static.inclusionconf.com/static/images/agenda-right-wap.png" alt=""></div>
		</div>
	</div>
</template>

<script>
	import protal from "@/api/protal"

	export default {
		data() {
			return {
				agendas: [],
				activeIndex: 0,
				leftActive: -1,
				rightActive: -1
			}
		},
		created() {
			this.agendaList()
		},
		watch: {
			En() {
				this.agendaList()
			}
		},
		methods: {
			activeFn(index, item) {
				this.jsAPI('waitan_forumFilter', {
					filterName_var: item.date,
				})
				this.activeIndex = index
			},
			agendaList() {
				protal.agendaList({
					showType: this.En ? 'en' : 'cn',
					year: '2025'
				}).then(res => {
					this.agendas = res.data
				})
			},
			linkHostForum() {
				this.jsAPI('waitan_homeClick', {
					floor_var: '大会议程',
					position_var: '2',
					flowName_var: this.agendas[this.activeIndex].mainForum['name'].split('：')[1],
					industryFirstCate_var: '无',
					industrySecCate_var: '无',
					tabName_var: this.agendas[this.activeIndex].date
				})

				this.jsAPI('waitan_forumContentClick', {
					contentId_var: this.agendas[this.activeIndex].mainForum['uuid'],
					contentName_var: this.agendas[this.activeIndex].mainForum['name'].split('：')[1],
					position_var: this.activeIndex + 1,
				})
				// this.$router.push('/hostForum')
			},
			linkForum() {
				this.jsAPI('waitan_homeClick', {
					floor_var: '大会议程',
					position_var: '2',
					flowName_var: '查看更多',
					industryFirstCate_var: '无',
					industrySecCate_var: '无',
					tabName_var: this.agendas[this.activeIndex].date
				})
				this.jsAPI('waitan_forumMoreClick')
				uni.navigateTo({
					url: '/pages/jianjieForum/index'
				});
			},
			itemFn(item, index) {
				this.jsAPI('waitan_homeClick', {
					floor_var: '大会议程',
					position_var: '2',
					flowName_var: item.name,
					industryFirstCate_var: '无',
					industrySecCate_var: '无',
					tabName_var: this.agendas[this.activeIndex].date
				})

				this.jsAPI('waitan_forumContentClick', {
					contentId_var: item.uuid,
					contentName_var: item.name,
					position_var: this.activeIndex + 1,
				})

				if (this.En) {
					return
				}

				if (item.type == 'activity') {
					this.linkWeb('stage')
				} else {
					uni.navigateTo({
						url: '/pages/jianjieForum/detail?uuid=' + item.uuid
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.agenda-wrapper {
		padding-top: 20px;

		.agenda-content {
			width: 100%;
			padding: 0 18px 20px;
			box-sizing: border-box;
			margin: 0 auto;
		}

		.btn {
			width: 90px;
			height: 28px;
			background: rgba(60, 45, 170, 0.5);
			display: flex;
			align-items: center;
			justify-content: center;
			font-family: AlibabaPuHuiTi_3_45_Light;
			font-size: 11px;
			color: #FFFFFF;
			line-height: 1;
			text-align: left;
			font-style: normal;
			margin: 14px auto 0;
			cursor: pointer;

			img {
				width: 11px;
				height: 11px;
				margin-left: 4px;
			}
		}
	}

	.tabs {
		display: flex;
		width: 100%;
		overflow: auto;
		height: 36px;
		padding-top: 3px;
		box-sizing: border-box;
		margin: 18px 0 14px;

		&::-webkit-scrollbar {
			display: none;
		}

		.tab {
			height: 30px;
			margin-right: 6px;
			display: inline-flex;
			white-space: nowrap;
			align-items: center;
			justify-content: center;
			font-family: AlibabaPuHuiTi_3_65_Medium;
			font-size: 14px;
			color: #FFFFFF;
			line-height: 14px;
			font-style: normal;
			padding: 0 16px;
			cursor: pointer;
			border: 1px solid #808399;

			&.active {
				background: #784DFF;
				border: none;
			}
		}
	}

	.agendas {
		.agenda {
			width: 100%;
			min-height: 180px;
			// background: url(https://static.inclusionconf.com/static/images/agenda-wap-bg-new.png);
			// background-size: calc(100% + 24px) calc(100% + 24px);
			// background-position: -12px -12px;
			background: #6534FF;
			padding: 22px 16px 20px;
			margin-bottom: 10px;
			box-sizing: border-box;
			cursor: pointer;

			.agenda-top {
				padding-bottom: 16px;
				border-bottom: 1px solid rgba(255, 255, 255, 0.22);

				span {
					height: 22px;
					background: rgba(255, 255, 255, 0.13);
					font-family: AlibabaPuHuiTi_3_65_Medium;
					font-size: 12px;
					color: #FFFFFF;
					line-height: 1;
					text-align: left;
					font-style: normal;
					padding: 0 10px;
					display: inline-flex;
					align-items: center;
					justify-content: center;
					margin-right: 6px;
					position: relative;
					top: -2px;
				}

				small {
					font-family: AlibabaPuHuiTi_3_65_Medium;
					font-size: 18px;
					color: #FFFFFF;
					line-height: 22px;
					text-align: left;
					font-style: normal;
					flex: 1;
					overflow: hidden;
				}
			}

			.agenda-bottom {
				padding-top: 16px;

				span {
					display: block;
					font-family: AlibabaPuHuiTi_3_65_Medium;
					font-size: 13px;
					color: #FFFFFF;
					line-height: 16px;
					text-align: left;
					font-style: normal;
					margin-bottom: 15px;
				}
			}
		}

		.agenda-item {
			cursor: pointer;
			margin-bottom: 10px;
			width: 100%;
			border: 1px solid rgba(255, 255, 255, 0.2);
			padding: 22px 16px 56px;
			position: relative;
			box-sizing: border-box;

			.huifang {
				position: absolute;
				right: 0;
				top: 0;
				height: 23px;
				background: rgba(120, 77, 255, 0.2);
				font-family: AlibabaPuHuiTi_3_65_Medium;
				font-size: 11px;
				color: rgba(120, 77, 255, 1);
				line-height: 1;
				text-align: left;
				font-style: normal;
				padding: 0 8px;
				display: flex;
				align-items: center;
			}

			&:last-child {
				margin-bottom: 0;
			}

			.agenda-item-top {

				span {
					overflow: hidden;
					height: 22px;
					background: rgba(120, 77, 255, 0.2);
					padding: 0 10px;
					margin-right: 6px;
					font-family: AlibabaPuHuiTi_3_65_Medium;
					font-size: 12px;
					color: #784DFF;
					line-height: 1;
					text-align: left;
					font-style: normal;
					display: inline-flex;
					align-items: center;
					justify-content: center;
					position: relative;
					top: -2px;
				}

				small {
					font-family: AlibabaPuHuiTi_3_65_Medium;
					font-size: 16px;
					color: #FFFFFF;
					line-height: 23px;
					text-align: left;
					font-style: normal;
					flex: 1;
					overflow: hidden;
					display: inline;
				}
			}

			.agenda-item-bottom {
				font-family: AlibabaPuHuiTi_3_45_Light;
				font-size: 11px;
				color: rgba(255, 255, 255, 0.84);
				line-height: 17px;
				text-align: left;
				font-style: normal;
				margin-top: 10px;
				display: -webkit-box !important;
				-webkit-box-orient: vertical;
				-webkit-line-clamp: 2;
				overflow: hidden !important;
			}

			.left {
				position: absolute;
				left: 14px;
				bottom: 11px;
				font-family: AlibabaSans102Ver2;
				font-size: 24px;
				font-weight: normal;
				line-height: 24px;
				color: #7C5CFF;
				display: flex;
				align-items: flex-end;

				i {
					font-style: normal;
				}

				span {
					font-size: 12px;
					font-family: AlibabaPuHuiTi_3_45_Light;
					line-height: 16px;
					margin-left: 3px;
				}
			}

			.img {
				position: absolute;
				right: 16px;
				bottom: 10px;
				width: 16px;
				height: 16px;
			}
		}
	}
</style>